-- 用户信息表创建语句
CREATE TABLE T_USER (
  USERID   NUMBER(10)   NOT NULL,
  USERNAME VARCHAR2(10) NOT NULL,
  PASSWORD VARCHAR2(16) NOT NULL,
  ROLENAME VARCHAR2(6)  NOT NULL,
  CONSTRAINT T_USER_PK PRIMARY KEY (USERID),
)
  -- 添加表注释和列注释
  COMMENT ON TABLE T_USER IS '用户信息表';
COMMENT ON COLUMN T_USER.USERID IS '用户id，用于登录';
COMMENT ON COLUMN T_USER.USERNAME IS '用户名';
COMMENT ON COLUMN T_USER.PASSWORD IS '用户密码';
COMMENT ON COLUMN T_USER.ROLENAME IS '角色名';
-- 创建序列实现主键自增
CREATE SEQUENCE SEQ_T_USER_ID
INCREMENT BY 1
  START WITH 1
  MINVALUE 1
  MAXVALUE 1000
  NOCYCLE
  NOCACHE
  -- 插入数据
INSERT INTO T_USER(USERID, USERNAME, PASSWORD, ROLENAME)
VALUES (SEQ_T_USER_ID.NEXTVAL, '罗亮', '123456', '管理员');
INSERT INTO T_USER (USERID, USERNAME, PASSWORD, ROLENAME)
VALUES (SEQ_T_USER_ID.NEXTVAL, '张三', '123456', '售票员');

